﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title>EvidenceBillPage</title>
    <script src="/Scripts/Common/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script src="/Scripts/Common/Common.js" type="text/javascript"></script>
    <script src="/Scripts/Common/json2.js" type="text/javascript"></script>
    <script src="/Scripts/Common/jquery-barcode-2.0.2.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            var mEviBillObj;
            var mEviObj;
            var args = getUrlArgs();
            var eviBillId = args["EviBillId"];
            $.ajax({
                url: "/Case/LoadEvidenceBill",
                type: "POST",
                dataType: "json",
                async: false,
                data: { "evidenceBillId": eviBillId },
                success: function (req) {
                    if (req.IsSuccess) {
                        mEviBillObj = JSON.parse(req.Bill);
                        mEviObj = eval(req.Details);
                        FillInBillInfoBlank(mEviBillObj);
                        FillInEviInfoBlank(mEviObj);
                        CreateBarCodeBySerialNo(mEviBillObj.SerialNo);
                    }
                },
            });
        });
        function FillInBillInfoBlank(eviBillObj) {
            $('#lblajbh').text(eviBillObj.Number);
            $('#lblajlx').text(eviBillObj.Category.Name);
            $('#lbldjbh').text(eviBillObj.SerialNo);
            $('#lblbadw').text(eviBillObj.TransferDept.Name);
            $('#lblbary').text(eviBillObj.Transfer.Name);
            $('#lbllxfs').text(eviBillObj.TransferPhone);
            $('#lblbgbm').text(eviBillObj.ManageDept.Name);
            $('#lblbzsm').text(eviBillObj.Description);
            $('#lblzdbm').text(eviBillObj.Department.Name);
            $('#lblzdry').text(eviBillObj.Preparer.Name);
            $('#lblzdsj').text(gFormatDateFormCSharp(eviBillObj.BillTime));
            if (eviBillObj.IsCheck) {
                $('#lblshdw').text(eviBillObj.CheckDept.Name);
                $('#lblshry').text(eviBillObj.Checker.Name);
                $('#lblshsj').text(gFormatDateFormCSharp(eviBillObj.CheckTime));
            }
        };
        function FillInEviInfoBlank(eviObj) {
            var innerhtml = '<tr style="height: 30px"><td colspan="7" style="text-align: left; font: bold 20px 微软雅黑 100"><label>涉案物品列表</label></td></tr>';
            innerhtml += '<tr style="height: 30px"><td></td><td><label>类型</label></td><td><label>名称</label></td><td><label>型号</label></td><td>';
            innerhtml += '<label>数量</label></td><td><label>所有人</label></td><td><label>扣押来源</label></td></tr>';
            if (eviObj.length == 0) {
                innerhtml += '<tr><td colspan="7">无相关涉案物品</td></tr>';
            } else {
                for (var i = 0; i < eviObj.length; i++) {
                    innerhtml += '<tr style="height: 30px">';
                    innerhtml += '<td>' + (i + 1) + '</td><td>' + eviObj[i].EvidenceType.Name + '</td><td>' + eviObj[i].Name + '</td><td>' + eviObj[i].Model + '</td>';
                    innerhtml += '<td>' + eviObj[i].Qty + '</td><td>' + eviObj[i].OwnerName + '</td><td>' + eviObj[i].Origin.Name + '</td>';
                    innerhtml += '</tr>';
                }
            }
            innerhtml += '<tr><td colspan="7"></td></tr>';
            $("#tbEvidences").html(innerhtml);
        };
        function CreateBarCodeBySerialNo(serialNo) {
            if (serialNo == undefined || serialNo == "") {
                $("#barcodeTargetevi").html("生成条码失败");
            } else {
                var values = "01" + serialNo.substring(2, serialNo.length);
                var btype = "ean13";
                var settings = {
                    output: "css",
                    bgColor: "#FFFFFF",
                    color: "#000000",
                    barWidth: 1,
                    barHeight: 40,
                    moduleSize: 5,
                    posX: 10,
                    posY: 20,
                    addQuietZone: 1
                };
                $("#barcodeTargetevi").html("").show().barcode(values, btype, settings);
            }
        };
    </script>
</head>

<body>
    <div>
        <table style="width: 100%; height: 200px; border: 1px solid black; border-bottom: 0px; border-collapse: collapse" border="1">
            <tr style="height: 50px">
                <td colspan="5" style="text-align: center; font: bold 30px 微软雅黑 100; border-right: 0px">
                    <label>物品记录单据</label>
                </td>
                <td style="width: 150px; height: 50px; border-left: 0px">
                    <div id="barcodeTargetevi"></div>
                </td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: center">
                    <label>案件编号:</label></td>
                <td>
                    <label id="lblajbh"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>案件类型:</label></td>
                <td>
                    <label id="lblajlx"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>单据编号:</label></td>
                <td>
                    <label id="lbldjbh"></label>
                </td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: center">
                    <label>办案单位:</label></td>
                <td>
                    <label id="lblbadw"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>办案人员:</label></td>
                <td>
                    <label id="lblbary"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>联系方式:</label></td>
                <td>
                    <label id="lbllxfs"></label>
                </td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: center">
                    <label>保管部门:</label></td>
                <td colspan="5">
                    <label id="lblbgbm"></label>
                </td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: center">
                    <label>备注说明:</label></td>
                <td colspan="5">
                    <label id="lblbzsm"></label>
                </td>
            </tr>
            <tr>
                <td colspan="6"></td>
            </tr>
        </table>
        <table id="tbEvidences" style="width: 100%; height: 300px; text-align: center; border: 1px solid black; border-bottom: 0px; border-collapse: collapse" border="1">
        </table>
        <table style="width: 100%; height: 60px; border: 1px solid black; border-collapse: collapse" border="1">
            <tr>
                <td colspan="6"></td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: center">
                    <label>制单部门:</label></td>
                <td>
                    <label id="lblzdbm"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>制单人员:</label></td>
                <td>
                    <label id="lblzdry"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>制单时间:</label></td>
                <td>
                    <label id="lblzdsj"></label>
                </td>
            </tr>
            <tr>
                <td style="width: 100px; text-align: center">
                    <label>审核部门:</label></td>
                <td>
                    <label id="lblshdw"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>审核人员:</label></td>
                <td>
                    <label id="lblshry"></label>
                </td>
                <td style="width: 100px; text-align: center">
                    <label>审核时间:</label></td>
                <td>
                    <label id="lblshsj"></label>
                </td>
            </tr>
        </table>
    </div>
</body>
</html>
